import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

async function main() {
  // 清除现有数据
  await prisma.dish.deleteMany();

  // 插入示例数据
  const dishes = [
    {
      name: '宫保鸡丁',
      price: 38.0,
      image: '/images/dishes/kungpao-chicken.jpg',
      tags: JSON.stringify(['川菜', '辣味', '招牌菜']),
      isToday: true,
      description: '经典川菜，口感麻辣鲜香'
    },
    {
      name: '清炒时蔬',
      price: 22.0,
      image: '/images/dishes/vegetable.jpg',
      tags: JSON.stringify(['素菜', '清淡', '健康']),
      isToday: true,
      description: '新鲜时令蔬菜，清淡爽口'
    },
    {
      name: '红烧狮子头',
      price: 48.0,
      image: '/images/dishes/meatball.jpg',
      tags: JSON.stringify(['苏菜', '肉类', '传统']),
      isToday: false,
      description: '选用上等猪肉制作，口感细腻'
    }
  ];

  for (const dish of dishes) {
    await prisma.dish.create({
      data: dish
    });
  }

  console.log('数据库种子数据创建成功！');
}

main()
  .catch((e) => {
    console.error(e);
    process.exit(1);
  })
  .finally(async () => {
    await prisma.$disconnect();
  }); 